/* This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. */ 
package de.rockon.fuzzy.controller.gui.propertyeditor;

import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;

import javax.swing.JPanel;

import de.rockon.fuzzy.controller.model.FuzzyBasicElement;

public abstract class PropertyBase extends JPanel implements KeyListener {
	private static final long serialVersionUID = -436778838810944841L;

	public abstract void getPropertyValues(FuzzyBasicElement<?, ?> property);

	public abstract void initGUI();

	public void keyPressed(KeyEvent e) {
		// nichts
	}

	public void keyReleased(KeyEvent e) {
		if (e.getKeyCode() == KeyEvent.VK_ENTER) {
			saveProperties();
		} else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
			resetProperties();
		}
	}

	public void keyTyped(KeyEvent e) {
		// nichts
	}

	public abstract void resetProperties();

	public abstract void saveProperties();

}
